﻿using nMongo.Tests.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace nMongo.Tests.Repository
{
    public class _MongoRepositoryTestsPrepare
    {
        public static void RevertAnyChanges()
        {
            MongoRepository<User> users = new MongoRepository<User>(TestsConfiguration.ConnectionString, TestsConfiguration.DatabaseName);
            users.DeleteAll();
            if (users.CollectionQuery.Any(x => x.Name != null))
            {
                throw new InvalidProgramException("The last test operation was not reverted.");
            }
        }
    }
}
